package com.sleepingcat.ft_flutter.activity.test

import android.app.Activity
import android.os.Bundle
import com.cat.android.lib_base.base.BaseActivity
import com.cat.android.lib_ui.ext.onClick
import com.idlefish.flutterboost.FlutterBoost
import com.idlefish.flutterboost.containers.FlutterViewContainer
import com.sleepingcat.ft_flutter.channel.ChannelManager
import com.sleepingcat.lib_flutter.databinding.ActivityTestBinding

/**
 * @作者 志浩
 * @时间 2025/3/12 20:39
 * @描述 TODO
 */
class Test1Activity : BaseActivity<ActivityTestBinding>(), FlutterViewContainer {
    private val TAG = "Test1Activity"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        FlutterBoost.instance().plugin.onContainerCreated(this)
        binding.apply {
            tv.text = "Test1"
            btn.text = "跳去Personal"
            btn.onClick {
                ChannelManager.userChannel.flutterApi.pushPersonalPage { }
            }
        }
    }

    override fun getContextActivity(): Activity {
        return this
    }

    override fun getUrl(): String {
        return "native/test1"
    }

    override fun getUrlParams(): MutableMap<String, Any> {
        return mutableMapOf()
    }

    override fun getUniqueId(): String {
        return "native/test1".hashCode().toString()
    }

    override fun finishContainer(result: MutableMap<String, Any>?) {
        finish()
    }
}